package com.liaowei.article.openfeign;

import com.liaowei.article.config.OpenFeignConfig;
import com.liaowei.common.BaseResponse;
import com.liaowei.model.domain.ArticleComment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@FeignClient(value = "comment-service", configuration = OpenFeignConfig.class)
public interface ArticleCommentClient {

    // 删除文章评论
    @DeleteMapping("comments/articles/{articleId}/{userId}")
    BaseResponse<String> deleteComment(@PathVariable("articleId") Long articleId,
                                       @PathVariable("userId") Long userId);


    // 查询用户是否对该文章评论过
    @GetMapping("/comments/articles/isComment/{articleId}/{userId}")
    BaseResponse<List<ArticleComment>> isCommented(@PathVariable("articleId") Long articleId,
                                                   @PathVariable("userId") Long userId);
}
